package com.frinder.data.service;

import com.frinder.data.domain.model.MapCells;
import com.frinder.data.domain.service.IMapCellsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @ClassName BizMapCellsService
 * @Description 地图格子服务类
 * @Author frinder
 * @Date 2019/9/27 11:39
 * @Verion 1.0
 */
@Service
public class BizMapCellsService {

    @Autowired
    private IMapCellsService mapCellsService;

    /**
     * 加载地图格子
     *
     * @return
     */
    public Map<Integer, List<MapCells>> loadMapCells() {
        return mapCellsService.findAll()
                .stream()
                .collect(Collectors.groupingBy(MapCells::getPathNo));
    }
}
